<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:th="www.thymeleaf.org"
       xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
</head>
<body>
<h1>Hello 小伙子</h1>
<div th:fragment="logout" sec:authorize="isAuthenticated()">
    登录用户：<span sec:authentication="name"></span>|
    用户角色：<span sec:authentication="principal.authorities"></span>
    <div>
        <form action="#" th:action="@{/logout}" method="post">
            <input type="submit" value="登出">
        </form>
    </div>
</div>
<ul>
    <li>点击<a href="/user/index" th:href="@{/user/index}">去/user/index已被保护的页面</a></li>
</ul>
</body>
</html>